<!DOCTYPE html>

<html>
    <head>
        <meta charset="UTF-8">
        <title>WebSocket Client</title>
 
        <script type="text/javascript">
            var ws = new WebSocket("ws://localhost:8079/example");

            ws.onopen = function() {
                alert( "Web Socket is connected!" );
            };

            ws.onmessage = function (evt) {
                var msg = evt.data;
                var contents = document.getElementById("contents");
                contents.innerHTML = contents.innerHTML + msg + "<br/>";
            };

            ws.onclose = function() { 
                alert( "Connection is closed." ); 
            };
         </script>
    </head>

    <body>
        <h1>Web Sockets change events receiver</h1>
        <p id="contents"></p>
    </body>
</html>
